import request from "@/router/axios";

export const getList = (current, size, params) => {
  return request({
    url: "/api/server-shop/admin/goods/page",
    method: "get",
    params: {
      ...params,
      current,
      size,
    },
  });
};

export const getCount = (params) => {
  return request({
    url: "/api/server-shop/admin/goods/status",
    method: "get",
    params: {
      ...params,
    },
  });
};

export const getDetail = (id) => {
  return request({
    url: "/api/server-shop/admin/goods/info",
    method: "get",
    params: {
      id,
    },
  });
};

export const remove = (ids) => {
  return request({
    url: "/api/server-shop/admin/goods/remove",
    method: "post",
    params: {
      ids,
    },
  });
};

export const add = (row) => {
  return request({
    url: "/api/server-shop/admin/goods/save",
    method: "post",
    data: row,
  });
};

export const update = (row) => {
  return request({
    url: "/api/server-shop/admin/goods/update",
    method: "post",
    data: row,
  });
};

export const updateFast = (row) => {
  return request({
    url: "/api/server-shop/admin/goods/update/fast",
    method: "post",
    data: row,
  });
};

export const audit = (form) => {
  return request({
    url: "/api/server-shop/admin/goods/audit",
    method: "post",
    data: form,
  });
};

export const goodsUp = (ids) => {
  return request({
    url: "/api/server-shop/admin/goods/up",
    method: "post",
    params: {
      ids,
    },
  });
};

export const goodsDown = (ids) => {
  return request({
    url: "/api/server-shop/admin/goods/down",
    method: "post",
    params: {
      ids,
    },
  });
};

export const getGoodsCategoryList = () => {
  return request({
    url: "/api/server-shop/admin/goods/category/list",
    method: "get",
  });
};

export const getGoodsCategoryTree = () => {
  return request({
    url: "/api/server-shop/admin/goods/category/tree",
    method: "get",
  });
};

export const getTransportList = () => {
  return request({
    url: "/api/server-shop/admin/transport/list",
    method: "get",
  });
};

export const getGoodsSnapshotList = (current, size, params) => {
  return request({
    url: "/api/server-shop/admin/goods/snapshot/page",
    method: "get",
    params: {
      ...params,
      current,
      size,
    },
  });
};

export const getGoodsSnapshotDetail = (id) => {
  return request({
    url: "/api/server-shop/admin/goods/snapshot/info",
    method: "get",
    params: {
      id,
    },
  });
};

export const levellist = (params) => {
  return request({
    url: "/api/server-user/admin/user/level/list",
    method: "get",
    params,
  });
};
